﻿<%@ Application Language="VB" %>
<%@ Import Namespace="touchmsg_dev12Model" %>
<%@ Import Namespace="System.Web.Optimization" %>
<%@ Import Namespace="System.Web.Routing" %> 
<%@ Import Namespace="System.Web.DynamicData" %>

<script runat="server">

    Private Shared s_defaultModel As New MetaModel
    Public Shared ReadOnly Property DefaultModel() As MetaModel
        Get
            Return s_defaultModel
        End Get
    End Property

    Public Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
        '                     IMPORTANT: DATA MODEL REGISTRATION 
        ' Uncomment this line to register an ADO.NET Entity Framework model for ASP.NET Dynamic Data.
        ' Set ScaffoldAllTables = true only if you are sure that you want all tables in the
        ' data model to support a scaffold (i.e. templates) view. To control scaffolding for
        ' individual tables, create a partial class for the table and apply the
        ' <ScaffoldTable(true)> attribute to the partial class.
        ' Note: Make sure that you change "YourDataContextType" to the name of the data context
        ' class in your application.
        ' See http://go.microsoft.com/fwlink/?LinkId=257395 for more information on how to register Entity Data Model with Dynamic Data
        ' DefaultModel.RegisterContext( _
        '   New System.Func(Of Object)(Function() DirectCast(New YourDataContextType(), IObjectContextAdapter).ObjectContext), _
        '   New ContextConfiguration() With {.ScaffoldAllTables = False} _
        ' )

        ' The following registration should be used if YourDataContextType does not derive from DbContext
        ' DefaultModel.RegisterContext(GetType(YourDataContextType), New ContextConfiguration() With {.ScaffoldAllTables = False})
        DefaultModel.RegisterContext(GetType(touchmsg_dev12Entities), New ContextConfiguration() With {.ScaffoldAllTables = True})

        ' The following statement supports separate-page mode, where the List, Detail, Insert, and 
        ' Update tasks are performed by using separate pages. To enable this mode, uncomment the following 
        ' route definition, and comment out the route definitions in the combined-page mode section that follows.
        routes.Add(New DynamicDataRoute("{table}/{action}.aspx") With {
            .Constraints = New RouteValueDictionary(New With {.Action = "List|Details|Edit|Insert"}),
            .Model = DefaultModel})

        ' The following statements support combined-page mode, where the List, Detail, Insert, and
        ' Update tasks are performed by using the same page. To enable this mode, uncomment the
        ' following routes and comment out the route definition in the separate-page mode section above.
        'routes.Add(New DynamicDataRoute("{table}/ListDetails.aspx") With {
        '    .Action = PageAction.List,
        '    .ViewName = "ListDetails",
        '    .Model = DefaultModel})

        'routes.Add(New DynamicDataRoute("{table}/ListDetails.aspx") With {
        '    .Action = PageAction.Details,
        '    .ViewName = "ListDetails",
        '    .Model = DefaultModel})
    End Sub

    Private Shared Sub RegisterScripts()
        ScriptManager.ScriptResourceMapping.AddDefinition("jquery", New ScriptResourceDefinition With {
            .Path = "~/Scripts/jquery-1.7.1.min.js",
            .DebugPath = "~/Scripts/jquery-1.7.1.js",
            .CdnPath = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.min.js",
            .CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.js",
            .CdnSupportsSecureConnection = True,
            .LoadSuccessExpression = "window.jQuery"
        })
    End Sub

    
    Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs on application startup
        BundleConfig.RegisterBundles(BundleTable.Bundles)
        AuthConfig.RegisterOpenAuth()
        RegisterRoutes(RouteTable.Routes)
        RegisterScripts()
    End Sub

    Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs on application shutdown
    End Sub

    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs when an unhandled error occurs
    End Sub

</script>